package io.geekidea.boot.allocation.sevice.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.geekidea.boot.allocation.dto.AllocationExcel;
import io.geekidea.boot.allocation.dto.addAllocation;
import io.geekidea.boot.allocation.entity.Allocation;
import io.geekidea.boot.allocation.mapper.AllocationMapper;
import io.geekidea.boot.allocation.query.AllocationQuery;
import io.geekidea.boot.allocation.query.MaterialQuery;
import io.geekidea.boot.allocation.sevice.AllocationService;
import io.geekidea.boot.materials.entity.Materials;
import io.geekidea.boot.otherstores.query.total;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

@Service
@Transactional(rollbackFor = {Exception.class})
public class AllocationServiceImpl extends ServiceImpl<AllocationMapper, Allocation> implements AllocationService {
    @Resource
    private AllocationMapper allocationMapper;

    @Override
    public List<Allocation> getList(AllocationQuery allocationQuery) {
        return allocationMapper.getList(allocationQuery);
    }

    @Override
    public total getTotal(AllocationQuery allocationQuery) {
        return allocationMapper.getTotal(allocationQuery);
    }

    @Override
    public boolean addAllocation(addAllocation addAllocation) {
        return allocationMapper.addAllocation(addAllocation) > 0;
    }

    @Override
    public List<Materials> getWL(MaterialQuery materialQuery) {
        return allocationMapper.getWL(materialQuery);
    }

    @Override
    public Allocation getAllById(Integer id) {
        return allocationMapper.getAllById(id);
    }

    @Override
    public List<AllocationExcel> getListExcel(AllocationQuery allocationQuery) {
        return allocationMapper.getListExcel(allocationQuery);
    }


}
